<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../../include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>会员列表</title>

<link rel="stylesheet" type="text/css"
	href="${ctx}/resources/media/css/select2_metro.css" />
<link rel="stylesheet"
	href="${ctx}/resources/media/css/DT_bootstrap.css" />
<link rel="stylesheet" href="${ctx}/resources/media/css/dialog.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/resources/media/css/datepicker.css" />	

<style>
#s2id_status{vertical-align:top}
</style>

<%@ include file="../../include/treetable.jsp" %>	
	
</head>
<body>
	<div class="row-fluid profile">
		<div class="span12">
			<!--BEGIN TABS-->
			<div class="tabbable tabbable-custom tabbable-full-width">
				<ul class="nav nav-tabs">
					<li class="active"><a href="${ctx}/member/user">提现订单列表</a></li>					
				</ul>
				<div class="tab-content">
                    <div class="alert alert-block alert-warning fade in hide">
                        <button type="button" class="close" data-dismiss="alert"></button>
                        <h4 class="alert-heading">请注意!</h4>
                        <p>
                            你正在执行一个删除操作，你将删除被标记为"<strong style="color:red" class="title">站点标题</strong>"的数据。
                            <br/>请确保你知晓执行该操作的后果，该操作不可恢复！
                        </p>
                        <p>
                            <a class="btn red cconfirm" href="javascript:;">继续删除</a> <a class="btn blue cclose" href="javascript:;">放弃操作</a>
                        </p>

                    </div>
					<div class="tab-pane row-fluid active" id="tab_1_1">
						<div class=" responsive" data-tablet="span12 fix-offset">
							<!-- BEGIN EXAMPLE TABLE PORTLET-->
							<div class="portlet box grey">
								<div class="portlet-title">
									<div class="caption">
										<i class="icon-list"></i>提现订单列表
									</div>
								</div>
								<div class="portlet-body">
                                    <div class="row-fluid">
                                        <div class="span12 ">
                                            <input type="text" placeholder="会员编号" id="memberId" class="m-wrap normal">
                                            <select  style="width:150px" id="status">
                                            	<option value="-1">全部</option>
                                            	<option value="0">已成功订单</option>
                                            	<option value="3">未成功订单</option>
                                            </select>
                                              <div class="input-append date form_meridian_datetime">
                                             <input size="16" type="text" id="start_time" name="startTime" value="" readonly class="m-wrap"  placeholder="交易开始时间">
                                             <span class="add-on"><i class="icon-remove"></i></span>
                                             <span class="add-on"><i class="icon-calendar"></i></span>
                                         </div>
                                          <div class="input-append date form_meridian_datetime">
                                             <input size="16" type="text" id="start_time" name="endTime" value="" readonly class="m-wrap"  placeholder="交易结束时间">
                                             <span class="add-on"><i class="icon-remove"></i></span>
                                             <span class="add-on"><i class="icon-calendar"></i></span>
                                         </div>
                                            <button class="btn blue" onclick="search()" style="vertical-align:top"><i class="icon-search"></i> 搜索</button>

                                        </div>
                                    </div>
									<table class="table table-striped table-bordered table-hover " 
										id="dataTable">
										<thead>
											<tr >
                                                <th>会员编号</th>
                                                <th>提现流水</th>												
												<th>账号编号</th>
												<th>交易银行卡号</th>
												<th>银行卡户名</th>	
												
												<th>提现金额</th>
												<th>提现用途</th>
												<th>手续费用</th>
												<th>申请时间</th>
												<th>审核时间</th>
											
												<th>支付状态</th>
												<th style="width:120px">操作</th>
											</tr>
										</thead>
										<tbody>

										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>
					<!--end tab-pane-->
				</div>
			</div>
			<!--END TABS-->

					<div class="theme-popover">
					     <div class="theme-poptit">
					          <a href="javascript:;" title="关闭" class="close"></a>
					          <h3>提现订单审核</h3>
					     </div>
					     <div class="theme-popbod dform">
					           <form class="theme-signin" name="loginform" >
					                <ol>
					                     <li><label class="radio" style="float:left"><input type="radio" name="optionsRadios2" value="0" />通过 </label>
					                     <label class="radio"><input type="radio" name="optionsRadios2" value="3" checked />不通过</label>
					                     <input type="hidden" id="id" />
					                     </li>					                     
					                     <li><strong>审核内容</strong>
					                     <textarea class="ipt" style="width:450px" name="description" id="description" ></textarea>
										</li>
					                     <li>
					                     <input class="btn btn-primary" type="button" name="submit" value=" 审核 " onclick="dialogSubmit(2)" style="float:right;margin-right:80px;padding-bottom:28px" />
					                     <span id="msg" style="color: red"></span>
					                     </li>
					                </ol>
					           </form>
					     </div>
					</div>
					<div class="theme-popover-mask"></div>
		</div>
	</div>
		 <script type="text/javascript" src="${ctx}/resources/media/js/bootstrap-datepicker.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/select2.min.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/jquery.dataTables.js"></script>
	<script type="text/javascript"
		src="${ctx}/resources/media/js/DT_bootstrap.js"></script>
	<script type="text/javascript">

        var dt;

		$(function() {
			
			$("select").select2();
			 $(".form_meridian_datetime").datepicker({
	             format: "yyyy-m-d",
	             language:"zh",
	             autoclose: true,
	             todayBtn: true
	         });	

            dt = $('#dataTable')
					.dataTable(
							{
								"bLengthChange" : false,
								"bFilter" : true,
								"bInfo" : false,
								"iDisplayLength" : 10,
								"bSort" : false,
								"sDom" : "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
								"sPaginationType" : "bootstrap",
                                "bServerSide":true,
                                "sAjaxSource":"${ctx}/core/order/withdrawal/witData.json",
								"oLanguage" : {
									"oPaginate" : {
										"sPrevious" : "上一页",
										"sNext" : "下一页"
									}
								},
                                "aoColumns":[
                                             {
                                                 "mData":"memberId"
                                             },{
                                                 "mData":"serialNumber"
                                             },{
                                                 "mData":"accountId"
                                             },{
                                                 "mData":"cardNumbert"
                                             },{
                                                 "mData":"accountTitle"
                                             },{
                                                 "mData":"amount"
                                             },{
                                                 "mData":"purpose"
                                             },{
                                                 "mData":"fee"
                                             },{
                                                 "mData":"applyDate"
                                             },{
                                                 "mData":"auditDate"
                                             },{
                                                 "mData":"porcStatus",
                                                 "fnRender":function(oObj){
                                                     var text = "";
                                                     if(oObj.aData.status == 2 ){
                                                         text = "待审核";
                                                     }else if(oObj.aData.status == 3){
                                                         text = "<font color='red'>审核失败</font>";
                                                     } else if(oObj.aData.status == 0){
                                                         text = "审核通过";
                                                     }
                                                     return text;
                                                 }
                                             },{
		                                        "mData":null,
		                                        "fnRender":function(oObj){
		                                        	if(oObj.aData.status == 2 ){
		                                            return '<a href="javascript:;" class="btn mini blue" onclick="dialog('+"'"+oObj.aData.id+"'"+')">\
		                                                    <i class=" icon-eye-open"></i> 审核 \
		                                            </a>\ ';
		                                        	}else{
		                                        		return null;
		                                        	}

                                        }
                                    }

                                ],
                                "fnServerData":function(sSource,aoData,fnCallback){
                                    for(i in aoData){
                                        if(aoData[i].name == "sSearch")
                                            aoData[i].name = "memberId";
                                    }
                                    aoData.push({name:'status',value:$("#status").val()}); 
                                    $.ajax({
                                        "dataType":'json',
                                        "type":'POST',
                                        "url":sSource,
                                        "data":aoData,
                                        "success":fnCallback
                                    });
                                }
							});

			jQuery('#dataTable_wrapper .row-fluid:first').remove();
			jQuery('#dataTable_wrapper .dataTables_length select').addClass(
					"m-wrap small"); // modify table per page dropdown
		});

        function search(){
            dt.fnFilter($("#memberId").val());
        }

		function dialog(id){	
				$('.theme-popover-mask').fadeIn(100);
				$('.theme-popover').slideDown(200);	
				$("#id").val(id);
			$('.theme-poptit .close').click(function(){
				$('.theme-popover-mask').fadeOut(100);
				$('.theme-popover').slideUp(200);
			})
 
		}
       
		function dialogSubmit(){
			$("#msg").text("");
			var audtiStatus = $('input[name="optionsRadios2"]:checked').val();
			var id = $("#id").val();
			var content = $("#description").val();
			if(content == "" && audtiStatus == 3 ){
				$("#msg").text("审核不通过时,审核内容不能为空");
				setTimeout(function(){
					$("#msg").text("");
				}, 3000 );
				return false;
			}
			  $.post("${ctx}/core/order/audit/"+id,{content:content,audtiStatus:audtiStatus},function(result){        	  
	              if(result.success){
            	    alertBasic("提示信息",result.message,function(){
						location.href = "withdrawal";	
					},3);
	              }else{
	            	  alertBasic("提示信息",result.message,null,3);
	            	  return;
	              }
	          },"json")
		}
        
        function del(id,title,confirm){
            if(confirm == undefined){
                $(".alert-warning").show();
                $("strong.title").html(title);
                $(".cclose").click(function(){
                    $(".alert-warning").hide();
                });
                $(".cconfirm").unbind("click");
                $(".cconfirm").bind("click",function(){
                    del(id,title,1);
                })
            }else{
                $.post("${ctx}/member/delete/"+id,null,function(result){
                    if(result.success){
                        $(".cclose").click();
                        search();
                    }
                },"json")
            }
        }

	</script>
</body>
</html>